package com.liaoyi.myble.collector;

import android.app.Activity;

import com.liaoyi.myble.App;

import java.util.ArrayList;
import java.util.List;

public class ActivityCollector {

    private static List<Activity> activitys = new ArrayList<Activity>();

    public static void addActivity(Activity activity){
        activitys.add(activity);
    }

    public static void removeActivity(Activity activity){
        activitys.remove(activity);
    }

    public static void finishAll(){
        for (Activity activity:activitys){
            if(!activity.isFinishing()){
                activity.finish();
            }
        }
        App.instance.unbindService();
    }
}
